﻿@model IEnumerable<laboration2.Models.Contact>

@{
    ViewBag.Title = "Kontakter";
}

@section heading {
        <p>You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out.</p>
        <p>@Html.ActionLink("Skapa ny kontakt »", "Create", null, new { @class = "btn primary" })</p>
}
<table>
    <tr>
        <th>
            Förnamn
        </th>
        <th>
            Efternamn
        </th>
        <th>
            Email
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.FirstName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.EmailAddress)
        </td>
        <td class="buttoncell">
            @Html.ActionLink("Ändra", "Edit", new { id = item.ContactID }, new { @class = "btn primary" })
            @Html.ActionLink("Detaljer", "Details", new { id = item.ContactID }, new { @class = "btn info" })
            @Html.ActionLink("Ta bort", "Delete", new { id = item.ContactID }, new { @class = "btn danger" })
        </td>
    </tr>
}

</table>
<div class="pagination">
<ul>
@if (ViewBag.HasPrevious){<li class="previous">@Html.ActionLink("← Föregående", "Index", new { page = (ViewBag.CurrentPage - 1) }, new { @class ="prev disabled"})</li>}
else{ <li class="previous">@Html.ActionLink("← Föregående", "Index", new { page = (ViewBag.CurrentPage - 1) }, new { @class = "prev disabled" })</li>}
<li><a href="#" >@ViewBag.CurrentPage</a></li>
@if (ViewBag.HasNext)
{ 
    <li class="next">@Html.ActionLink("Nästa →", "Index", new { page = (ViewBag.CurrentPage + 1) })</li>
}
else
{<li class="next">@Html.ActionLink("Nästa →", "Index", new { page = (ViewBag.CurrentPage + 1) })</li> }
</ul>
</div>
